<?php namespace App\Services;

use App\Models\Role;
use Illuminate\Http\Request;

class RoleService
{

    public function getList(Request $request)
    {
        $search = Role::where([]);
        if (($request->input('name')))
            $search->where('name', 'like', '%' . $request->input('name') . '%');
        return $search->orderBy($request->input('orderField', 'id'), $request->input('orderDirection', 'desc'))
            ->paginate($request->input('pageSize', config('view')['numPerPage']));
    }

    public function create(Array $data)
    {
    }

    public function update($id, Array $data)
    {
    }

    public function delete($id)
    {
    }
}